#encoding:UTF-8
import urllib
import urllib.request

url = "http://www.baidu.com"
data = urllib.request.urlopen(url).read()
a = urllib.request.urlopen(url)
print(type(data))
print(a.geturl())
print(a.info())
print(a.getcode())
data = data.decode('UTF-8')
# print(data)

print('''

二.用ptyhon 简单处理url
如果要抓取百度上面搜索关键词为Jecvay Notes的网页, 则代码如下
''')
data = {}
data['word'] = '美图'

url_value = urllib.parse.urlencode(data)
url = "http://www.baidu.com/s?"
full_url = url+url_value
data = urllib.request.urlopen(full_url).read()
data = data.decode('UTF-8')
print(data)